package com.yuanthink.gwt.client.registry;

import java.util.HashMap;

import com.yuanthink.gwt.client.actions.IAction;
/**
 * 
 * @author 06peng
 *
 */
public class ActionRegistry implements IActionRegistry {
	
	HashMap<String, IAction> map;
	
    @SuppressWarnings({ "unchecked", "rawtypes" })
	ActionRegistry(){
        map = new HashMap();
    }

	@Override
	public void register(String name, IAction action) {
		 map.put(name,action);
	}

	@Override
	public IAction getAction(String name) {
		return map.get(name);
	}

	public static IActionRegistry actionRegistry;

	public static IActionRegistry getInstance() {
		if (actionRegistry == null) {
			actionRegistry = new ActionRegistry();
		}
		return actionRegistry;
	}
}
